<?php

use yii\db\Migration;

/**
 * Class m190926_071957_banner
 */
class m190926_071957_banner extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="banner表"';
        $this->createTable('{{%banner}}', [
            'id' => $this->primaryKey(),
            'mid' => $this->integer()->notNull()->comment('模块id 1 首页 2影视学堂  3 项目中心'),
            'title' => $this->string()->notNull()->comment('标题'),
            'status' => $this->smallInteger()->notNull()->defaultValue(1)->comment('用户组状态 1:启用 0:停用 2删除'),
            'url' => $this->text()->comment('跳转链接'),
            'pic' => $this->string()->notNull()->comment('图片'),
            'info' => $this->string()->comment('简介说明'),
            'sorts' => $this->integer()->notNull()->defaultValue(1)->comment('排序'),
            'created_at' => $this->integer()->notNull(),
            'updated_at' => $this->integer()->notNull(),
            'deleted_at' => $this->integer(),
        ],$tableOptions);
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $this->dropTable('{{%banner}}');
        return false;
    }

    /*
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {

    }

    public function down()
    {
        echo "m190926_071957_banner cannot be reverted.\n";

        return false;
    }
    */
}
